Package nz.ac.massey.softwarec.group3.session

Source Code of nz.ac.massey.softwarec.group3.session.GameTrackerTest

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nz.ac.massey.softwarec.group3.session;

import java.util.ArrayList;
import java.util.List;
import nz.ac.massey.softwarec.group3.game.Game;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author wanting
*/
public class GameTrackerTest {
   
    
      GameTracker instance=new GameTracker();
      List<Game> expResult=new ArrayList<Game>();
      List<Game> result=new ArrayList<Game>();
   
    public GameTrackerTest() {
    }

    @Before
    public void setUp(){ 
        expResult.add(instance.createNewGame("test1"));
        expResult.add(instance.createNewGame("test2"));
    }
   
    @After
    public  void tearDown(){
       
    }

   
    @Test
    public void testGetAvailableGames() {
        System.out.println("getAvailableGames");
     
        result=instance.getAvailableGames();
        assertEquals(expResult,result);
 
    }

    /**
     * Test of getCurrentNumberOfAvailableGames method, of class GameTracker.
     */
   
    @Test
    public void testGetCurrentNumberOfAvailableGames() {
       
        System.out.println("getCurrentNumberOfAvailableGames");
      
        int expResult = 2;
        int result = instance.getCurrentNumberOfAvailableGames();
        assertSame(expResult, result);

    }

    /**
     * Test of createNewGame method, of class GameTracker.
     */
   
    @Test
    public void testCreateNewGame() {
       
    System.out.println("createNewGame");
    expResult.add(instance.createNewGame("test3"));
    expResult.add(instance.createNewGame("test4"));
    result=instance.getAvailableGames();
   
        assertEquals(expResult,result);
 
          
    
    }

    /**
     * Test of getGameMadeByCreator method, of class GameTracker.
     */
   
    @Test
    public void testGetGameMadeByCreator() {
       
       
        System.out.println("getGameMadeByCreator");
       
       String creatorUserName="wanting";
       Game result=instance.createNewGame("wanting");
       Game expect=instance.getGameMadeByCreator(creatorUserName);
       assertSame(expect,result)

    }

    /**
     * Test of getGameWithUserInIt method, of class GameTracker.
     */
   
    @Test
    public void testGetGameWithUserInIt() {
       
        System.out.println("getGameWithUserInIt");
       
        Game result=instance.createNewGame("wanting");
        Game expResult=instance.getGameWithUserInIt("wanting");       
  
        assertEquals(expResult, result);

    }


}
TOP

Related Classes of nz.ac.massey.softwarec.group3.session.GameTrackerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.